<template>
  <div class="tab">
    <van-tabs v-bind="$attrs" v-model:active="active">
      <van-tab v-for="(item,index) in props.config" :key="index" :title="item.label">
        <slot :name="item.slotName"></slot>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script setup lang="ts">
import { computed } from "vue";
interface item {
  label: string
  id: number | string
  slotName?: string
}
let props = defineProps<{
  modelValue: number | string
  config: item []
}>()
let emits = defineEmits<{
  (e: 'update:modelValue', value: string | number): void
}>()
let active = computed({
  get: () => props.modelValue,
  set: (val) => {
    emits('update:modelValue',val)
  }
})
</script>

<style lang="scss" scoped>
  
</style>
